<div class="flex items-center gap-x-8">
  <div class="menu-bar__language-chooser-desktop">
    <%= render partial: "layouts/decidim/header/main_language_chooser" %>
  </div>
  <% if !current_user %>
    <div>
      <%= link_to decidim.new_user_session_path, class: "main-bar__links-desktop__item", "aria-label": t("layouts.decidim.header.log_in") do %>
        <%= icon "user-line" %><span><%= t("layouts.decidim.header.log_in") %></span>
      <% end %>
    </div>
  <% else %>
    <div class="main-bar__dropdown-container">
      <button id="trigger-dropdown-account" class="main-bar__dropdown-trigger" data-controller="dropdown" data-target="dropdown-menu-account">
        <% unread_data = current_user_unread_data %>
        <% if unread_data[:unread_items] %>
          <%= content_tag :span, "", class: "main-bar__notification", data: unread_data %>
          <% if unread_data[:unread_notifications] %>
            <%= content_tag :span, t("layouts.decidim.user_menu.unread_notifications"), class: "sr-only" %>
          <% end %>
          <% if unread_data[:unread_conversations] %>
            <%= content_tag :span, t("layouts.decidim.user_menu.unread_conversations"), class: "sr-only" %>
          <% end %>
        <% end %>
        <% if current_user.avatar.attached? %>
          <span class="main-bar__avatar">
            <span>
              <%= image_tag(
                    current_user.attached_uploader(:avatar).variant_url(:thumb),
                    alt: t("decidim.author.avatar", name: decidim_sanitize(current_user.avatar.name))
                  ) %>
            </span>
          </span>
        <% else %>
          <span class="main-bar__links-desktop__item-account">
            <%= text_initials(current_user.name) %>
          </span>
        <% end %>
      </button>
      <div id="dropdown-menu-account" aria-hidden="true">
        <ul class="dropdown dropdown__bottom main-bar__dropdown">
          <%= render partial: "layouts/decidim/header/main_links_dropdown", locals: { unread_data: } %>
        </ul>
      </div>
    </div>
  <% end %>
  <button id="main-dropdown-summary-desktop" class="main-bar__links-desktop__trigger"
          data-controller="dropdown"
          data-target="dropdown-menu-main-desktop" aria-expanded="false">
    <%= icon "menu-line" %><span><%= t("menu", scope: "decidim.admin.titles") %></span>
  </button>

  <div id="dropdown-menu-main-desktop" class="main-bar__links-desktop__dropdown main-bar__links-desktop__dropdown-before" aria-hidden="true">
    <%= render partial: "layouts/decidim/header/menu_breadcrumb_main_dropdown_desktop", locals: { id: "breadcrumb-main-dropdown-desktop" } %>
  </div>
</div>
